package com.example.myapplication10;

import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;

public class BookingActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_booking);

        ListView listViewCounselors = findViewById(R.id.listViewCounselors);
        List<String> counselorList = new ArrayList<>();
        counselorList.add("张医生 - 抑郁症专家");
        counselorList.add("李医生 - 焦虑症专家");
        counselorList.add("王医生 - 青少年心理专家");
        counselorList.add("赵医生 - 婚姻家庭咨询师");
        counselorList.add("陈医生 - 创伤治疗专家");
        counselorList.add("刘医生 - 睡眠障碍专家");
        counselorList.add("杨医生 - 亲子关系专家");
        counselorList.add("吴医生 - 职场心理专家");
        counselorList.add("周医生 - 老年心理专家");
        counselorList.add("孙医生 - 社交恐惧症专家");

        ArrayAdapter<String> adapter = new ArrayAdapter<>(
                this,
                android.R.layout.simple_list_item_1,
                counselorList
        );

        listViewCounselors.setAdapter(adapter);

        listViewCounselors.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                String selectedCounselor = counselorList.get(position);
                Intent intent = new Intent(BookingActivity.this, BookingDetailActivity.class);
                intent.putExtra("counselorName", selectedCounselor);
                startActivity(intent);
            }
        });
    }
}